package cc.rboot.masking.processor;

import cc.rboot.masking.core.IDataMaskingProcessor;

import java.util.ArrayList;
import java.util.List;

public class DefaultDataMaskingProcessor implements IDataMaskingProcessor<String> {

    private final static String REPLACE_STR = "*";
    private final static List<String> SENSITIVE_REGEX_LIST = new ArrayList<>();

    {
        SENSITIVE_REGEX_LIST.add("违禁品");
        SENSITIVE_REGEX_LIST.add("违禁药物");
//        SENSITIVE_REGEX_LIST.add("[0-9]");
    }

    @Override
    public String masking(String data, String condition) {
        for (String regex : SENSITIVE_REGEX_LIST) {
            data = data.replaceAll(regex, REPLACE_STR);
        }
        return data;
    }
}
